<?php

require_once 'woflow/entity/State.class.php';
require_once 'woflow/Logger.class.php';

class StateInfoWorker{

    public $workflows = array();

    public function start(){
        //1. init workflows
        //1.1 load all configurations of the defined workflows
        //1.2 put the workflows into the workflow pool
        //2. repair other support objects
        //2.1 log
        //2.2 cache
        //3. register stateInfo call
        //4. start to accept client requests
    }

    public function stateInfo($workflow, $entityId, $uid){
       //$state = new State();
       if(!isset($this->workflows[$workflow])){
           Logger::error('Invalid workflow '. $workflow , 500, __FILE__, __LINE__);
           return FALSE;
       }

       $wfObj = $this->workflows[$workflow];
       $state = $wfObj->stateInfo($entityId, $uid);
       return  $state;
    } 
}
